//
//  NoteClienteViewController.m
//  InterventixApp
//
//  Created by Diego Falcinelli on 16/03/14.
//
//

#import "NoteClienteViewController.h"

@interface NoteClienteViewController ()

@end

@implementation NoteClienteViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    if(![self.cliente.note isEqual:[NSNull null]]){
        self.oldNote = self.cliente.note;
        self.note.text = self.cliente.note;
    }else{
        self.oldNote = @"";
        self.note.text = @"";
    }
    self.titolo.text = [NSString stringWithFormat:@"Note del cliente %@",self.cliente.idcliente];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(IBAction) indietro{
    self.cliente.note = self.note.text;
	[[self navigationController] popViewControllerAnimated:YES];
    
}

-(IBAction) salva{
    self.cliente.note = self.note.text;
    [[self navigationController] popViewControllerAnimated:YES];
}

-(IBAction) ripristina{
    self.cliente.note = self.oldNote;
    self.note.text = self.cliente.note;
}

-(IBAction) chiudiTastiera{
    [self.note resignFirstResponder];
}

@end
